-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Add support for DragonFly #48195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add support for DragonFly #48195
Conversation
|
|
||
| execute_process( | ||
| COMMAND "${PATCHELF}" --set-rpath "${new_rpath}" "${elf_file}" | ||
| COMMAND "${PATCHELF}" --add-rpath "${new_rpath}" "${elf_file}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this is incorrect because it seems like it would append entries to the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one change is why I still have it marked as draft, the issue is some GCC versions that are in the official ports repository (including the default one if I recall correctly) set their own rpath which is needed for binaries to work. I'm not sure how to really deal with that in a different way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU our script tries to set a combined rpath, with z_vcpkg_calculate_corrected_rpath considering the original rpath as reported by patch_elf.
And there is a test port, scripts/test_ports/vcpkg-fix-rpath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU our script tries to set a combined rpath, with
z_vcpkg_calculate_corrected_rpathconsidering the original rpath as reported by patch_elf. And there is a test port,scripts/test_ports/vcpkg-fix-rpath.
Right but as far as I can tell there's no handling for system rpaths. I noticed something similar on NetBSD where official GCC 14 sets the rpath to "/usr/pkg/gcc14/x86_64--netbsd/lib/.:/usr/pkg/gcc14/lib/." and this just gets overriden by vcpkg. This can get fixed by just setting a correct LD_LIBRARY_PATH but that's really a half fix, what should really be done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is meant by "system rpath" in your answer?
What is the final rpath which want for a given "system rpath" and executable in the vcpkg installed tree? Give a concrete example, as if writing a test case.
What I see is that our script calls "${PATCHELF}" --print-rpath "${elf_file}". Doesn't this include the rpath which is to be retained?
If yes, then we know that it is passed as readelf_output to
z_vcpkg_calculate_corrected_rpath(
ELF_FILE_DIR "${elf_file_dir}"
ORG_RPATH "${readelf_output}"
OUT_NEW_RPATH_VAR new_rpath
)
Doesn't the output new_rpath include the rpath which is to be retained?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is meant by "system rpath" in your answer?
When the rpath is set by the compiler by default (and really as a requirement) because the system libraries for the specific compiler are not in the default dynamic linker path. NetBSD and DragonFly use this when you have multiple versions of GCC installed each with their own version of libstdc++, etc.
What is the final rpath?
This log shows that the rpath is read correctly, it just gets replaced entirely by vcpkg:
-- Adjusted RPATH of ... (From '/usr/pkg/gcc14/x86_64--netbsd/lib/.:/usr/pkg/gcc14/lib/.:lib' -> To '$ORIGIN:$ORIGIN/../../lib')
And once again checking with patchelf after the install:
$ patchelf --print-rpath ...
$ORIGIN:$ORIGIN/../../lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current default behavior is to only keep entries with $ORIGIN.
There is an X_VCPKG_RPATH_KEEP_SYSTEM_PATHS variable to keep all entries - you could set in the triplet file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Yes, it will keep all entries, including those set by the port. I'm not sure this is the solution. The alternative is to provide/detect what the compiler sets in a controlled way, and put this on a positive list.)
Respective tool PR: microsoft/vcpkg-tool#1841